//
//  TL_LoadMoreFooter.m
//  WXReader
//
//  Created by Andrew on 2019/11/11.
//  Copyright © 2019 Andrew. All rights reserved.
//

#import "TL_LoadMoreFooter.h"

@interface TL_LoadMoreFooter ()

@property (weak, nonatomic) UILabel *footerToastLabel;

@end

@implementation TL_LoadMoreFooter

- (void)prepare
{
    [super prepare];
    
    // 设置控件的高度
    self.wx_height = 50;
    
    // 添加label
    UILabel *label = [[UILabel alloc] init];
    label.textColor = kBlackColor;
    label.textAlignment = NSTextAlignmentCenter;
    label.font = SYSTEM_FONT(12);
    [self addSubview:label];
    
    self.footerToastLabel = label;
}

#pragma mark 在这里设置子控件的位置和尺寸
- (void)placeSubviews
{
    [super placeSubviews];
    
    self.footerToastLabel.frame = CGRectMake(0, - (PUB_TABBAR_HEIGHT + 40) + 30, SCREEN_WIDTH, 20);
}

#pragma mark 监听scrollView的contentOffset改变
- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change
{
    [super scrollViewContentOffsetDidChange:change];
    
}

#pragma mark 监听scrollView的contentSize改变
- (void)scrollViewContentSizeDidChange:(NSDictionary *)change
{
    [super scrollViewContentSizeDidChange:change];
    
}

#pragma mark 监听scrollView的拖拽状态改变
- (void)scrollViewPanStateDidChange:(NSDictionary *)change
{
    [super scrollViewPanStateDidChange:change];
    
}

#pragma mark 监听控件的刷新状态
- (void)setState:(MJRefreshState)state
{
    MJRefreshCheckState;
    
    switch (state) {
        case MJRefreshStateIdle:
            self.footerToastLabel.text = WXLocalizedString(@"上拉加载下一篇");
            break;
        case MJRefreshStateRefreshing:
            self.footerToastLabel.text = WXLocalizedString(@"正在加载下一篇");
            break;
        case MJRefreshStatePulling:
            self.footerToastLabel.text = WXLocalizedString(@"松开加载下一篇");
            break;
        case MJRefreshStateNoMoreData:
            self.footerToastLabel.text = WXLocalizedString(@"已经是最后一话了");
            break;
        default:
            break;
    }
}

@end
